package com.bozhong.robot.bar.barcounter.ui;

import android.support.v7.app.AppCompatActivity;
import android.util.Log;

import com.bozhong.robot.bar.barcounter.model.HttpResultVO;
import com.bozhong.robot.bar.barcounter.utils.network.HttpCallBack;
import com.bozhong.robot.bar.barcounter.utils.network.HttpUtil;

import org.json.JSONObject;

/**
 * Created by Administrator on 2018/1/9.
 */

public class BaseActivity extends AppCompatActivity {

    private static final String TAG = BaseActivity.class.getSimpleName();



    public void sendPostRequest(final BaseActivity context, String url, JSONObject params, int requestCode) {

        HttpUtil.getInstance(this.getApplicationContext()).sendPostRequest(url, params, new HttpCallBack<HttpResultVO>() {

            @Override
            public void onSuccess(HttpResultVO data, int requestCode) {
                context.onSuccess(data, requestCode);
            }

            @Override
            public void onFail(String msg, int requestCode) {
                Log.i(TAG, ""+msg);
                context.onFail(msg, requestCode);
            }
        }, requestCode);
    }


    public void onSuccess(HttpResultVO data, int requestCode){
        Log.i(TAG, data.toString());

    }

    public void onFail(String msg, int requestCode) {

    }
}
